package com.ruoyi.web.controller.firststage;

import com.ruoyi.firststage.domain.BrandCategory;
import com.ruoyi.firststage.domain.BrandCategoryTest;
import com.ruoyi.firststage.service.IBrandCategoryService;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.web.core.base.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.tomcat.jni.Mmap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @创建人 cbx
 * @创建时间 2018/11/7 0007 下午 3:30
 * @描述  第一阶段品牌类型
 */
@Controller
@RequestMapping("/firststage/brandCategory")
public class BrandCategoryController extends BaseController {
    private String prefix = "firststage/brandCategory";

    @Autowired
    private IBrandCategoryService brandCategoryService;


    @RequiresPermissions("firststage:brandCategory:view")
    @GetMapping()
    public String user(ModelMap mmap)
    {
        List<String> brands = brandCategoryService.selectAllBrand();
        mmap.put("brands",brands);
        return prefix + "/list";
    }


    @RequiresPermissions("firststage:brandCategory:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo brandCategoryList(BrandCategory BrandCategory)
    {
        startPage();
        List<BrandCategory> brandCategories= brandCategoryService.selectBrandCategoryList(BrandCategory);
        return getDataTable(brandCategories);
    }

    @RequiresPermissions("firststage:brandCategory:list")
    @PostMapping("/listTest")
    @ResponseBody
    public TableDataInfo brandCategoryListTest(BrandCategoryTest brandCategory)
    {
        startPage();
        List<BrandCategoryTest> brandCategories= brandCategoryService.selectBrandCategoryListTest(brandCategory);
        return getDataTable(brandCategories);
    }


}
